﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Networking.NetworkOperators;

namespace WiFiDirectHotspotManager
{
    public class  WifiManager
    {

        private async void StartWifi()
        {

            var connectionProfile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();
            var tetheringManager = Windows.Networking.NetworkOperators.NetworkOperatorTetheringManager.CreateFromConnectionProfile(connectionProfile);
            var access = tetheringManager.GetCurrentAccessPointConfiguration();
            access.Ssid = "PWJ";
            access.Passphrase = "12345678";
           var result=  await tetheringManager.StartTetheringAsync();
            if(result.Status == TetheringOperationStatus.Success)
            {
                //wifi热点开启成功
            }
            
        }
    }
}
